package com.ktwlsoft.fundmanage.domain.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.validation.constraints.NotNull;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

/**
 * 银行账号配置
 *
 * @author Name on 2019/8/20 10:57
 * @version 1.0
 */
@ApiModel("银行账号配置-BankInfo")
@Entity
@Getter
@Setter
public class BankInfo extends BaseEntity{
	
	private static final long serialVersionUID = 6249039846165863802L;

	/**主键*/
	@ApiModelProperty("主键")
	@Id
	@Column(name = "id",columnDefinition = "bigint(30) NOT NULL COMMENT '主键'")
	private Long id;

	/**业务类型*/
	@ApiModelProperty("业务类型")
	@Column(name = "business_type",columnDefinition = "varchar(30) DEFAULT NULL COMMENT '业务类型'")
	@Enumerated(EnumType.STRING)
	private BusinessType businessType;

	@ApiModelProperty("账户名称")
	@Column(length = 30)
	private String account;

	/**银行类型*/
	@ApiModelProperty("银行类型")
	@Column(name = "bank_type",columnDefinition = "varchar(30) DEFAULT NULL COMMENT '银行类型'")
	@Enumerated(EnumType.STRING)
	private BankType bankType;
	
	/**银行名称*/
	@ApiModelProperty("银行名称")
	@Column(name = "bank_name",columnDefinition = "varchar(20) DEFAULT NULL COMMENT '银行名称'")
	private String bankName;

	/**支行名称*/
	@ApiModelProperty("支行名称")
	@Column(name = "sub_branch_name",columnDefinition = "varchar(20) DEFAULT NULL COMMENT '支行名称'")
	private String subBranchName;

	/**银行账号*/
	@ApiModelProperty("银行账号")
	@Column(name = "bank_number",columnDefinition = "varchar(100) DEFAULT NULL COMMENT '银行账号'")
	private String bankNumber;

	/**银行编码*/
	@ApiModelProperty("银行编码")
	@Column(name = "bank_code",columnDefinition = "varchar(50) DEFAULT NULL COMMENT '银行编码'")
	private String bankCode;

	/**编码*/
	@ApiModelProperty("编码")
	@Column(name = "sub_code",columnDefinition = "varchar(50) DEFAULT NULL COMMENT '编码'")
	private String subCode;

	/**是否启用*/
	@ApiModelProperty("是否启用")
	@Column(name = "active",columnDefinition = "bit DEFAULT 0 COMMENT '启用禁用'")
	@NotNull
	private boolean active;
	
	/**备注*/
	@ApiModelProperty("备注")
	@Column(name = "remark",columnDefinition = "varchar(50) DEFAULT NULL COMMENT '备注'")
	private String remark;

	/**银行id*/
	@ApiModelProperty("银行id")
	@Column(name = "bank_id",columnDefinition = "bigint(30) DEFAULT NULL COMMENT '银行id'")
	private Long bankId;
	
	public enum BusinessType{
		/**
		 * 监管银行
		 */
		SUPERVISE("监管银行"),
		/**
		 * 商业贷款银行
		 */
		LOAN("商业贷款银行"),
		/**
		 * 交款银行
		 */
		PAY_IN("缴款银行"),
		/**
		 * 收款银行
		 */
		RECEIPT("收款银行");
		
		@Getter
		private String name;
		
		private BusinessType(String name) {
			this.name = name;
		}
	}
	
	public enum BankType{
		/**
		 * 银行
		 */
		BANK,
		/**
		 * 账号
		 * */
		NUMBER,
		/**
		 * 支行
		 */
		SUB_BRANCH;
	}
}
